var ecWidget;
ecWidget || (function($)
{
   var _ecWidget = {
      params: {
         host: '',
         version: "0.1"
      },

      init: function(initParams)
      {
         jWidget.debug(initParams.host);
         $.extend(ecWidget.params, initParams);
         jWidget.info("ecWidget initialized, we're running on host " + ecWidget.params.host);
         ecWidget.sendTroughJsonp();
      },
      sendTroughJsonp: function(postParams, callbackFunction)
      {
         // default send parameters.
         jWidget.debug("firing JSONP request ");
         /*
          var defaultPostParams = {
          jsonpCallbackString: 'ecWidget.parseECXML'
          };
          $.extend(defaultPostParams, postParams);
          */
         /*
          $.getScript(ecWidget.params.host + "/?xsl=common/js/json/Ecxml2json.xsl", function(){
          alert("HOI" + ECResponse.community.name);
          });
          */

/*
         $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", function(data){
           $.each(data.items, function(i,item){
              alert(item.media.m);
             $("<img/>").attr("src", item.media.m).appendTo("#images")
               .wrap("<a href='" + item.link + "'></a>");
             if ( i == 3 ) { return false;};
           });
         });
*/

         $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
               function(data)
               {
               });

         $.getJSON("http://mohammed.fam/?xsl=common/js/json/Ecxml2json.xsl&jsoncallback=?",
               function(data)
               {
                  alert(data);
                  jWidget.debug("JSONP request responded");
                  if (callbackFunction === undefined)
                  {
                     jWidget.warn("no function specified to handle the jsonp data. Data:" + data);
                  }
                  else
                  {
                     callbackFunction(data);
                  }
               });
      },
      parseECXML: function (ecXml)
      {
         jWidget.info("parsing " + ecXml + " xml as EC XML");
      },
      version: function()
      {
         return ecWidget.params.version;
      }
   };

   ecWidget = _ecWidget;
})(jQuery);

ecWidget.fn || (function()
{
   var _fn = {
      version: ecWidget.version()
   };
   ecWidget.fn = _fn;

})();